import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";

export type gridCityResult = {
  code: number;
  message: string;
  data: {
    list: {
      provinceId: number;
      provinceName: string;
      cityId: number;
      cityName: string;
    };
  };
};

/**根据城市id获取城市信息 */
export const getGridCityById = (cityId: number) => {
  return http.request<gridCityResult>(
    "get",
    baseUrlApi("/result/gridCity/getGridCityById"),
    {
      params: { cityId: cityId }
    }
  );
};

/**根据省份id获取城市信息 */
export const getGridCityByProvinceId = (provinceId: number) => {
  return http.request<gridCityResult>(
    "get",
    baseUrlApi("/result/gridCity/getGridCityByProvinceId"),
    {
      params: { provinceId: provinceId }
    }
  );
};
